﻿using mozhi.smarterp.Business.Enums;
using System;
using System.Collections.Generic;

namespace mozhi.smarterp.Business.Collections
{
    public class Collection 
    {
        public Guid? Id { get; set; }

        public DateTime Date { get; set; }

        public CollectionType Type { set; get; }

        public TradingPartnerType TradingPartnerType { set; get; }

        public Guid? SupplierId { set; get; }

        public Guid? EmployeeId { set; get; }

        public Guid? CustomerId { set; get; }


        public Guid? BankAccountId { set; get; }

        public Guid CurrencyId { set; get; }

        public decimal ExchangeRate { set; get; }


        /// <summary>
        /// 是否预收款
        /// </summary>
        public bool IsAdvanced { set; get; }

        /// <summary>
        /// 是否退款
        /// </summary>
        public bool IsRefund { set; get; }

        public string Comment { get; set; }

        public List<CollectionItem> Items { set; get; }

        public Collection(DateTime date, CollectionType type, TradingPartnerType tradingPartnerType, Guid? supplierId, Guid? employeeId, Guid? customerId, Guid? bankAccountId, 
            Guid currencyId, decimal exchangeRate, bool isAdvanced, bool isRefund, string comment)
        {
            Date = date;
            Type = type;
            TradingPartnerType = tradingPartnerType;
            SupplierId = supplierId;
            EmployeeId = employeeId;
            CustomerId = customerId;
            BankAccountId = bankAccountId;
            CurrencyId = currencyId;
            ExchangeRate = exchangeRate;
            IsAdvanced = isAdvanced;
            IsRefund = isRefund;
            Comment = comment;
            Items = new List<CollectionItem>();
        }
    }

    public class CollectionItem
    {
        public decimal AmountFr { set; get; }

        public string Remark { set; get; }

        public CollectionItem(decimal amountFr, string remark)
        {
            AmountFr = amountFr;
            Remark = remark;
        }
    }


}
